from sqlalchemy.orm import Session

from app.db.session import db_action, get_db, db_close
from app.models.log import FuncallLog


def add_funcall_log( funcallInfo: FuncallLog):
    """添加工具调用日志到数据库"""
    db: Session = next(get_db())
    db.add(funcallInfo)
    db.commit()
    db.refresh(funcallInfo)
    db_close(db)

def edit_funcall_log( funcallInfo: FuncallLog) :
    """修改工具调用日志到数据库"""
    db: Session = next(get_db())
    db.add(funcallInfo)
    db.commit()
    db_close(db)